package com.cec.controller.user;


import com.cec.dto.ActivityRegDTO;
import com.cec.dto.user.UserActivityRegDTO;
import com.cec.dto.user.VolunteerActivityRegDTO;
import com.cec.result.Result;
import com.cec.service.user.UserActivityRegService;
import com.cec.service.user.VolunteerActivityRegService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("userActivityRegController")
@Api(tags = "用户活动报名")
@Slf4j
@RequestMapping("/user")
public class UserActivityRegController {

    @Autowired
    private UserActivityRegService userActivityRegService;

    @Autowired
    private VolunteerActivityRegService volunteerActivityRegService;

    @PostMapping("/userActivityReg")
    @ApiOperation("用户活动报名")
    public Result saveUserActivityReg(@RequestBody UserActivityRegDTO userActivityRegDTO) {
        return userActivityRegService.saveUserActivityReg(userActivityRegDTO);
    }

    @PostMapping("/volunteerActivityReg")
    @ApiOperation("志愿者活动报名")
    public Result saveVolunteerActivityReg(@RequestBody VolunteerActivityRegDTO volunteerActivityRegDTO) {
        return volunteerActivityRegService.saveVolunteerActivityReg(volunteerActivityRegDTO);
    }

    @GetMapping("/reg")
    public Result queryActivityRegByUserId() {
        return userActivityRegService.queryActivityRegByUserId();
    }

    @GetMapping("/volunteer/reg")
    public Result queryActivityRegByVolunteerId() {
        return volunteerActivityRegService.queryActivityRegByVolunteerId();
    }

    @GetMapping("/regList")
    @ApiOperation("分页查询活动报名列表")
    public Result pageQueryUserActivityReg(ActivityRegDTO activityRegDTO){
        log.info("分页查询活动报名列表");
        return userActivityRegService.pageQueryUserActivityReg(activityRegDTO);
    }

    @GetMapping("/volunteer/regList")
    @ApiOperation("分页查询活动报名列表")
    public Result pageQueryVolunteerActivityReg(ActivityRegDTO activityRegDTO){
        log.info("分页查询活动报名列表");
        return volunteerActivityRegService.pageQueryVolunteerActivityReg(activityRegDTO);
    }
}
